package com.evolved.automata.examples.sudoku;
import com.evolved.automata.*;
import java.util.*;

public class BoardTransform {
	
	private LinkedList[][] j_BoardDefinition;
	
	LinkedList<IntPair> j_CellsToAddValue; // Cells that chosen value must be added back to
	LinkedList<Integer> j_ValuesToReadd;  // Values of current cell to be added back
	
	IntPair j_ChosenCell;
	Integer j_ChosenValue;
	
	public BoardTransform(LinkedList[][] boardDefinition, Integer chosenValue, IntPair chosenCell, LinkedList<IntPair> cellsToAddValue, LinkedList<Integer> valuesToAddToChosenCell)
	{
		j_BoardDefinition=boardDefinition;
		j_ChosenCell=chosenCell;
		j_ChosenValue=chosenValue;
		j_CellsToAddValue=cellsToAddValue;
		j_ValuesToReadd=valuesToAddToChosenCell;
	}
	
	public void ExecuteTransform()
	{
		// Add 
		for (IntPair cell:j_CellsToAddValue)
		{
			j_BoardDefinition[cell.GetFirst()][cell.GetSecond()].add(j_ChosenValue);
		}
		
		for (Integer valueToAdd:j_ValuesToReadd)
			j_BoardDefinition[j_ChosenCell.GetFirst()][j_ChosenCell.GetSecond()].add(valueToAdd);
		
	}
	
}
